package mysql

type Goods struct {
	ID             int64
	GoodsName      string
	GoodsPrice     float64
	GoodsInventory int64
	GoodsViews     string
}

func WhereGoods(Id int64) Goods {
	var goods Goods
	db.Model(&Order{}).Where("id = ?", Id).First(&goods)
	return goods
}

func UpdateGoods(goods Goods) error {
	tx := db.Begin()
	err := tx.Model(&Goods{}).Where("id = ?", goods.ID).Save(&goods).Error
	if err != nil {
		tx.Rollback()

	}
	tx.Commit()
	return err
}
